Basic project setup (#4) 
diff --git a/.coveragerc b/.coveragerc new file mode 100644 index 0000000..494c03f --- /dev/null +++ b/.coveragerc 
@@ -0,0 +1,14 @@ +[run] +branch = True + +[report] +omit = + */samples/* + */conftest.py +exclude_lines = + # Re-enable the standard pragma + pragma: NO COVER + # Ignore debug-only repr + def __repr__ + # Don't complain if tests don't hit defensive assertion code: + raise NotImplementedError 
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..cd35d15 --- /dev/null +++ b/.gitignore 
@@ -0,0 +1,31 @@ +# Build artifacts +*.py[cod] +__pycache__ +*.egg-info/ +build/ +dist/ + +# Documentation-related +docs/_build + +# Test files +.tox/ +.cache/ + +# Django test database +db.sqlite3 + +# Coverage files +.coverage +coverage.xml +nosetests.xml +htmlcov/ + +# Files with private / local data +scripts/local_test_setup +tests/data/key.json +tests/data/key.p12 +tests/data/user-key.json + +# PyCharm configuration: +.idea 
diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..c95bd91 --- /dev/null +++ b/.travis.yml 
@@ -0,0 +1,23 @@ +language: python +sudo: false +matrix: + include: + - python: 3.5 + env: TOXENV=lint + - python: 3.5 + env: TOXENV=docs + - python: 2.7 + env: TOXENV=py27 + - python: 3.4 + env: TOXENV=py34 + - python: 3.5 + env: TOXENV=py35 + - python: 3.5 + env: TOXENV=cover +cache: + directories: + - ${HOME}/.cache +install: +- pip install --upgrade tox +script: +- tox 
diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst new file mode 100644 index 0000000..8581688 --- /dev/null +++ b/CONTRIBUTING.rst 
@@ -0,0 +1,78 @@ +Contributing +============ + +#. **Please sign one of the contributor license agreements below.** +#. Fork the repo, develop and test your code changes, add docs. +#. Make sure that your commit messages clearly describe the changes. +#. Send a pull request. + +Here are some guidelines for hacking on ``google-auth-library-python``. + +Making changes +-------------- + +A few notes on making changes to ``google-auth-libary-python``. + +- If you've added a new feature or modified an existing feature, be sure to + add or update any applicable documentation in docstrings and in the + documentation (in ``docs/``). You can re-generate the reference documentation + using ``tox -e docgen``. + +- The change must work fully on the following CPython versions: 2.7, + 3.4, and 3.5 across macOS, Linux, and Windows. + +- The codebase *must* have 100% test statement coverage after each commit. + You can test coverage via ``tox -e cover``. + +Testing changes +--------------- + +To test your changes, run unit tests with ``tox``:: + + $ tox -e py27 + $ tox -e py34 + $ tox -e py35 + +Coding Style +------------ + +This library is PEP8 & Pylint compliant. Our Pylint config is defined at +``pylintrc`` for package code and ``pylintrc.tests`` for test code. Use +``tox`` to check for non-compliant code:: + + $ tox -e lint + +Documentation Coverage and Building HTML Documentation +------------------------------------------------------ + +If you fix a bug, and the bug requires an API or behavior modification, all +documentation in this package which references that API or behavior must be +changed to reflect the bug fix, ideally in the same commit that fixes the bug +or adds the feature. + +To build and review docs use ``tox``:: + + $ tox -e docs + +The HTML version of the docs will be built in ``docs/_build/html`` + +Versioning +---------- + +This library follows `Semantic Versioning`_. + +.. _Semantic Versioning: http://semver.org/ + +It is currently in major version zero (``0.y.z``), which means that anything +may change at any time and the public API should not be considered +stable. + +Contributor License Agreements +------------------------------ + +Before we can accept your pull requests you'll need to sign a Contributor License Agreement (CLA): + +- **If you are an individual writing original source code** and **you own the intellectual property**, then you'll need to sign an `individual CLA <https://developers.google.com/open-source/cla/individual>`__. +- **If you work for a company that wants to allow you to contribute your work**, then you'll need to sign a `corporate CLA <https://developers.google.com/open-source/cla/corporate>`__. + +You can sign these electronically (just scroll to the bottom). After that, we'll be able to accept your pull requests. 
diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md new file mode 100644 index 0000000..501db63 --- /dev/null +++ b/CONTRIBUTORS.md 
@@ -0,0 +1,96 @@ +# Contribors to oauth2client / google-auth + +## Maintainers + +* [Jon Wayne Parrott](https://github.com/jonparrott) +* [Danny Hermes](https://github.com/dhermes) +* [Brian Watson](https://github.com/bjwatson) + +Previous maintainers: + +* [Nathaniel Manista](https://github.com/nathanielmanistaatgoogle) +* [Craig Citro](https://github.com/craigcitro) +* [Joe Gregorio](https://github.com/jcgregorio) + +## Contributors + +This list is generated from git commit authors. + +* aalexand <aalexand@google.com> +* Aaron <aaronwinter@users.noreply.github.com> +* Adam Chainz <me@adamj.eu> +* ade@google.com +* Alexandre Vivien <alx.vivien@gmail.com> +* Ali Afshar <afshar@google.com> +* Andrzej Pragacz <apragacz@o2.pl> +* api.nickm@gmail.com +* Ben Demaree <bendemaree@gmail.com> +* Bill Prin <waprin@gmail.com, waprin@google.com> +* Brendan McCollam <brendan@mccoll.am, bmccollam@uchicago.edu> +* Craig Citro <craigcitro@gmail.com, craigcitro@google.com> +* Dan Ring <dfring@gmail.com> +* Daniel Hermes <dhermes@google.com, daniel.j.hermes@gmail.com> +* Danilo Akamine <danilowz@gmail.com> +* daryl herzmann <akrherz@iastate.edu> +* dlorenc <lorenc.d@gmail.com> +* Dominik MiedziƄski <dominik@mdzn.pl> +* dr. Kertész Csaba-Zoltán <cskertesz@gmail.com> +* Dustin Farris <dustin@dustinfarris.com> +* Eddie Warner <happyspace@gmail.com> +* Edwin Amsler <EdwinGuy@GMail.com> +* elibixby <elibixby@google.com> +* Emanuele Pucciarelli <ep@acm.org> +* Eric Koleda <eric.koleda@google.com> +* Frederik Creemers <frederikcreemers@gmail.com> +* Guido van Rossum <guido@google.com> +* Harsh Vardhan <harshvd95@gmail.com> +* Herr Kaste <thdz.x@gmx.net> +* INADA Naoki <inada-n@klab.com> +* JacobMoshenko <moshenko@google.com> +* Jay Lee <jay0lee@gmail.com> +* Jed Hartman <jhartman@google.com> +* Jeff Terrace <jterrace@gmail.com, jterrace@google.com> +* Jeffrey Sorensen <sorensenjs@users.noreply.github.com> +* Jeremi Joslin <jeremi@collabspot.com> +* Jin Liu <liujin@google.com> +* Joe Beda <jbeda@google.com> +* Joe Gregorio <jcgregorio@google.com, joe.gregorio@gmail.com> +* Johan Euphrosine <proppy@google.com> +* John Asmuth <jasmuth@gmail.com, jasmuth@google.com> +* John Vandenberg <jayvdb@gmail.com> +* Jon Wayne Parrott <jon.wayne.parrott@gmail.com, jonwayne@google.com> +* Jose Alcerreca <jalc@google.com> +* KCs <cskertesz@gmail.com> +* Keith Maxwell <keith.maxwell@gmail.com> +* Ken Payson <kpayson@google.com> +* Kevin Regan <regank@google.com> +* lraccomando <lraccomando@gmail.com> +* Luar Roji <cyberplant@users.noreply.github.com> +* Luke Blanshard <leadpipe@google.com> +* Marc Cohen <marccohen@google.com> +* Mark Pellegrini <markpell@google.com> +* Martin Trigaux <mat@odoo.com> +* Matt McDonald <mmcdonald@google.com> +* Nathan Naze <nanaze@gmail.com> +* Nathaniel Manista <nathaniel@google.com> +* Orest Bolohan <orest@google.com> +* Pat Ferate <pferate@gmail.com> +* Patrick Costello <pcostello@google.com> +* Rafe Kaplan <rafek@google.com> +* rahulpaul@google.com <rahulpaul@google.com> +* RM Saksida <rsaksida@gmail.com> +* Robert Kaplow <rkaplow@google.com> +* Robert Spies <wilford@google.com> +* Sergei Trofimovich <siarheit@google.com> +* sgomes@google.com <sgomes@google.com> +* Simon Cadman <src@niftiestsoftware.com> +* soltanmm <soltanmm@users.noreply.github.com> +* Sébastien de Melo <sebastien.de-melo@ubicast.eu> +* takuya sato <sato-taku@klab.com> +* thobrla <thobrla@google.com> +* Tom Miller <tom.h.miller@gmail.com> +* Tony Aiuto <aiuto@google.com> +* Travis Hobrla <thobrla@google.com> +* Veres Lajos <vlajos@gmail.com> +* Vivek Seth <vivekseth.m@gmail.com> +* Éamonn McManus <eamonn@mcmanus.net> 
diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..d4dadec --- /dev/null +++ b/MANIFEST.in 
@@ -0,0 +1,4 @@ +include README.rst +graft google +graft tests +global-exclude *.pyc __pycache__ 
diff --git a/README.rst b/README.rst new file mode 100644 index 0000000..0f0b999 --- /dev/null +++ b/README.rst 
@@ -0,0 +1,53 @@ +Google Auth Python Library (Experimental) +========================================= + +|build| |docs| |pypi| + +This library simplifies using Google's various server-to-server authentication +mechanisms to access Google APIs. + +.. |build| image:: https://travis-ci.org/GoogleCloudPlatform/google-auth-library-python.svg?branch=master + :target: https://travis-ci.org/GoogleCloudPlatform//google-auth-library-python +.. |docs| image:: https://readthedocs.org/projects/google-auth/badge/?version=latest + :target: https://google-auth.readthedocs.io/en/latest/ +.. |pypi| image:: https://img.shields.io/pypi/v//google-auth.svg + :target: https://pypi.python.org/pypi/google-auth + +Installing +---------- + +You can install directly from `GitHub`_:: + + $ pip install git+https://github.com/GoogleCloudPlatform/google-auth-library-python.git + +This package is not currently available from PyPI because it is experimental. + +.. _GitHub: https://github.com/GoogleCloudPlatform/google-auth-library-python + +Documentation +------------- + +Google Auth Python Library has usage and reference documentation at `google-auth.readthedocs.io <https://google-auth.readthedocs.io>`_. + +Maintainers +----------- + +- `@jonparrott <https://github.com/jonparrott>`_ (Jon Wayne Parrott) +- `@dhermes <https://github.com/dhermes>`_ (Danny Hermes) +- `@bjwatson <https://github.com/bjwatson>`_ (Brian Watson) + +Contributing +------------ + +Contributions to this library are always welcome and highly encouraged. + +See `CONTRIBUTING`_ for more information on how to get started. + +.. _CONTRIBUTING: https://github.com/GoogleCloudPlatform/google-auth-library-python/blob/master/CONTRIBUTING.rst + +License +------- + +Apache 2.0 - See `LICENSE`_ for more information. + +.. _LICENSE: https://github.com/GoogleCloudPlatform/google-auth-library-python/blob/master/LICENSE 
diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 0000000..4887d62 --- /dev/null +++ b/docs/Makefile 
@@ -0,0 +1,225 @@ +# Makefile for Sphinx documentation +# + +# You can set these variables from the command line. +SPHINXOPTS = +SPHINXBUILD = sphinx-build +PAPER = +BUILDDIR = _build + +# Internal variables. +PAPEROPT_a4 = -D latex_paper_size=a4 +PAPEROPT_letter = -D latex_paper_size=letter +ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . +# the i18n builder cannot share the environment and doctrees with the others +I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . + +.PHONY: help +help: +	@echo "Please use \`make <target>' where <target> is one of" +	@echo " html to make standalone HTML files" +	@echo " dirhtml to make HTML files named index.html in directories" +	@echo " singlehtml to make a single large HTML file" +	@echo " pickle to make pickle files" +	@echo " json to make JSON files" +	@echo " htmlhelp to make HTML files and a HTML help project" +	@echo " qthelp to make HTML files and a qthelp project" +	@echo " applehelp to make an Apple Help Book" +	@echo " devhelp to make HTML files and a Devhelp project" +	@echo " epub to make an epub" +	@echo " epub3 to make an epub3" +	@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" +	@echo " latexpdf to make LaTeX files and run them through pdflatex" +	@echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx" +	@echo " text to make text files" +	@echo " man to make manual pages" +	@echo " texinfo to make Texinfo files" +	@echo " info to make Texinfo files and run them through makeinfo" +	@echo " gettext to make PO message catalogs" +	@echo " changes to make an overview of all changed/added/deprecated items" +	@echo " xml to make Docutils-native XML files" +	@echo " pseudoxml to make pseudoxml-XML files for display purposes" +	@echo " linkcheck to check all external links for integrity" +	@echo " doctest to run all doctests embedded in the documentation (if enabled)" +	@echo " coverage to run coverage check of the documentation (if enabled)" +	@echo " dummy to check syntax errors of document sources" + +.PHONY: clean +clean: +	rm -rf $(BUILDDIR)/* + +.PHONY: html +html: +	$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html +	@echo +	@echo "Build finished. The HTML pages are in $(BUILDDIR)/html." + +.PHONY: dirhtml +dirhtml: +	$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml +	@echo +	@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." + +.PHONY: singlehtml +singlehtml: +	$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml +	@echo +	@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." + +.PHONY: pickle +pickle: +	$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle +	@echo +	@echo "Build finished; now you can process the pickle files." + +.PHONY: json +json: +	$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json +	@echo +	@echo "Build finished; now you can process the JSON files." + +.PHONY: htmlhelp +htmlhelp: +	$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp +	@echo +	@echo "Build finished; now you can run HTML Help Workshop with the" \ + ".hhp project file in $(BUILDDIR)/htmlhelp." + +.PHONY: qthelp +qthelp: +	$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp +	@echo +	@echo "Build finished; now you can run "qcollectiongenerator" with the" \ + ".qhcp project file in $(BUILDDIR)/qthelp, like this:" +	@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/google-auth.qhcp" +	@echo "To view the help file:" +	@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/google-auth.qhc" + +.PHONY: applehelp +applehelp: +	$(SPHINXBUILD) -b applehelp $(ALLSPHINXOPTS) $(BUILDDIR)/applehelp +	@echo +	@echo "Build finished. The help book is in $(BUILDDIR)/applehelp." +	@echo "N.B. You won't be able to view it unless you put it in" \ + "~/Library/Documentation/Help or install it in your application" \ + "bundle." + +.PHONY: devhelp +devhelp: +	$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp +	@echo +	@echo "Build finished." +	@echo "To view the help file:" +	@echo "# mkdir -p $$HOME/.local/share/devhelp/google-auth" +	@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/google-auth" +	@echo "# devhelp" + +.PHONY: epub +epub: +	$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub +	@echo +	@echo "Build finished. The epub file is in $(BUILDDIR)/epub." + +.PHONY: epub3 +epub3: +	$(SPHINXBUILD) -b epub3 $(ALLSPHINXOPTS) $(BUILDDIR)/epub3 +	@echo +	@echo "Build finished. The epub3 file is in $(BUILDDIR)/epub3." + +.PHONY: latex +latex: +	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex +	@echo +	@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." +	@echo "Run \`make' in that directory to run these through (pdf)latex" \ + "(use \`make latexpdf' here to do that automatically)." + +.PHONY: latexpdf +latexpdf: +	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex +	@echo "Running LaTeX files through pdflatex..." +	$(MAKE) -C $(BUILDDIR)/latex all-pdf +	@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." + +.PHONY: latexpdfja +latexpdfja: +	$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex +	@echo "Running LaTeX files through platex and dvipdfmx..." +	$(MAKE) -C $(BUILDDIR)/latex all-pdf-ja +	@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." + +.PHONY: text +text: +	$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text +	@echo +	@echo "Build finished. The text files are in $(BUILDDIR)/text." + +.PHONY: man +man: +	$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man +	@echo +	@echo "Build finished. The manual pages are in $(BUILDDIR)/man." + +.PHONY: texinfo +texinfo: +	$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo +	@echo +	@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." +	@echo "Run \`make' in that directory to run these through makeinfo" \ + "(use \`make info' here to do that automatically)." + +.PHONY: info +info: +	$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo +	@echo "Running Texinfo files through makeinfo..." +	make -C $(BUILDDIR)/texinfo info +	@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." + +.PHONY: gettext +gettext: +	$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale +	@echo +	@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." + +.PHONY: changes +changes: +	$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes +	@echo +	@echo "The overview file is in $(BUILDDIR)/changes." + +.PHONY: linkcheck +linkcheck: +	$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck +	@echo +	@echo "Link check complete; look for any errors in the above output " \ + "or in $(BUILDDIR)/linkcheck/output.txt." + +.PHONY: doctest +doctest: +	$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest +	@echo "Testing of doctests in the sources finished, look at the " \ + "results in $(BUILDDIR)/doctest/output.txt." + +.PHONY: coverage +coverage: +	$(SPHINXBUILD) -b coverage $(ALLSPHINXOPTS) $(BUILDDIR)/coverage +	@echo "Testing of coverage in the sources finished, look at the " \ + "results in $(BUILDDIR)/coverage/python.txt." + +.PHONY: xml +xml: +	$(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml +	@echo +	@echo "Build finished. The XML files are in $(BUILDDIR)/xml." + +.PHONY: pseudoxml +pseudoxml: +	$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml +	@echo +	@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml." + +.PHONY: dummy +dummy: +	$(SPHINXBUILD) -b dummy $(ALLSPHINXOPTS) $(BUILDDIR)/dummy +	@echo +	@echo "Build finished. Dummy builder generates no files." 
diff --git a/docs/conf.py b/docs/conf.py new file mode 100644 index 0000000..bf27165 --- /dev/null +++ b/docs/conf.py 
@@ -0,0 +1,352 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +# +# google-auth documentation build configuration file, created by +# sphinx-quickstart on Thu Sep 22 12:50:15 2016. +# +# This file is execfile()d with the current directory set to its +# containing dir. +# +# Note that not all possible configuration values are present in this +# autogenerated file. +# +# All configuration values have a default; values that are commented out +# serve to show the default. + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +# +# import os +# import sys +# sys.path.insert(0, os.path.abspath('.')) + +# -- General configuration ------------------------------------------------ + +# If your documentation needs a minimal Sphinx version, state it here. +# +# needs_sphinx = '1.0' + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = [ + 'sphinx.ext.autodoc', + 'sphinx.ext.intersphinx', + 'sphinx.ext.viewcode', + 'sphinx.ext.napoleon', +] + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# The suffix(es) of source filenames. +# You can specify multiple suffix as a list of string: +# +# source_suffix = ['.rst', '.md'] +source_suffix = '.rst' + +# The encoding of source files. +# +# source_encoding = 'utf-8-sig' + +# The master toctree document. +master_doc = 'index' + +# General information about the project. +project = 'google-auth' +copyright = '2016, Google, Inc.' +author = 'Google, Inc.' + +# The version info for the project you're documenting, acts as replacement for +# |version| and |release|, also used in various other places throughout the +# built documents. +# +# The short X.Y version. +version = '0.0.1a' +# The full version, including alpha/beta/rc tags. +release = '0.0.1a' + +# The language for content autogenerated by Sphinx. Refer to documentation +# for a list of supported languages. +# +# This is also used if you do content translation via gettext catalogs. +# Usually you set "language" from the command line for these cases. +language = None + +# There are two options for replacing |today|: either, you set today to some +# non-false value, then it is used: +# +# today = '' +# +# Else, today_fmt is used as the format for a strftime call. +# +# today_fmt = '%B %d, %Y' + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +# This patterns also effect to html_static_path and html_extra_path +exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] + +# The reST default role (used for this markup: `text`) to use for all +# documents. +# +# default_role = None + +# If true, '()' will be appended to :func: etc. cross-reference text. +# +# add_function_parentheses = True + +# If true, the current module name will be prepended to all description +# unit titles (such as .. function::). +# +# add_module_names = True + +# If true, sectionauthor and moduleauthor directives will be shown in the +# output. They are ignored by default. +# +# show_authors = False + +# The name of the Pygments (syntax highlighting) style to use. +pygments_style = 'sphinx' + +# A list of ignored prefixes for module index sorting. +# modindex_common_prefix = [] + +# If true, keep warnings as "system message" paragraphs in the built documents. +# keep_warnings = False + +# If true, `todo` and `todoList` produce output, else they produce nothing. +todo_include_todos = False + + +# -- Options for HTML output ---------------------------------------------- + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +# +html_theme = 'alabaster' + +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. +# +# html_theme_options = {} + +# Add any paths that contain custom themes here, relative to this directory. +# html_theme_path = [] + +# The name for this set of Sphinx documents. +# "<project> v<release> documentation" by default. +# +# html_title = 'google-auth v0.0.1a' + +# A shorter title for the navigation bar. Default is the same as html_title. +# +# html_short_title = None + +# The name of an image file (relative to this directory) to place at the top +# of the sidebar. +# +# html_logo = None + +# The name of an image file (relative to this directory) to use as a favicon of +# the docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 +# pixels large. +# +# html_favicon = None + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] + +# Add any extra paths that contain custom files (such as robots.txt or +# .htaccess) here, relative to this directory. These files are copied +# directly to the root of the documentation. +# +# html_extra_path = [] + +# If not None, a 'Last updated on:' timestamp is inserted at every page +# bottom, using the given strftime format. +# The empty string is equivalent to '%b %d, %Y'. +# +# html_last_updated_fmt = None + +# If true, SmartyPants will be used to convert quotes and dashes to +# typographically correct entities. +# +# html_use_smartypants = True + +# Custom sidebar templates, maps document names to template names. +# +# html_sidebars = {} + +# Additional templates that should be rendered to pages, maps page names to +# template names. +# +# html_additional_pages = {} + +# If false, no module index is generated. +# +# html_domain_indices = True + +# If false, no index is generated. +# +# html_use_index = True + +# If true, the index is split into individual pages for each letter. +# +# html_split_index = False + +# If true, links to the reST sources are added to the pages. +# +# html_show_sourcelink = True + +# If true, "Created using Sphinx" is shown in the HTML footer. Default is True. +# +# html_show_sphinx = True + +# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. +# +# html_show_copyright = True + +# If true, an OpenSearch description file will be output, and all pages will +# contain a <link> tag referring to it. The value of this option must be the +# base URL from which the finished HTML is served. +# +# html_use_opensearch = '' + +# This is the file name suffix for HTML files (e.g. ".xhtml"). +# html_file_suffix = None + +# Language to be used for generating the HTML full-text search index. +# Sphinx supports the following languages: +# 'da', 'de', 'en', 'es', 'fi', 'fr', 'h', 'it', 'ja' +# 'nl', 'no', 'pt', 'ro', 'r', 'sv', 'tr', 'zh' +# +# html_search_language = 'en' + +# A dictionary with options for the search language support, empty by default. +# 'ja' uses this config value. +# 'zh' user can custom change `jieba` dictionary path. +# +# html_search_options = {'type': 'default'} + +# The name of a javascript file (relative to the configuration directory) that +# implements a search results scorer. If empty, the default will be used. +# +# html_search_scorer = 'scorer.js' + +# Output file base name for HTML help builder. +htmlhelp_basename = 'google-authdoc' + +# -- Options for LaTeX output --------------------------------------------- + +latex_elements = { + # The paper size ('letterpaper' or 'a4paper'). + # + # 'papersize': 'letterpaper', + + # The font size ('10pt', '11pt' or '12pt'). + # + # 'pointsize': '10pt', + + # Additional stuff for the LaTeX preamble. + # + # 'preamble': '', + + # Latex figure (float) alignment + # + # 'figure_align': 'htbp', +} + +# Grouping the document tree into LaTeX files. List of tuples +# (source start file, target name, title, +# author, documentclass [howto, manual, or own class]). +latex_documents = [ + (master_doc, 'google-auth.tex', 'google-auth Documentation', + 'Google, Inc.', 'manual'), +] + +# The name of an image file (relative to this directory) to place at the top of +# the title page. +# +# latex_logo = None + +# For "manual" documents, if this is true, then toplevel headings are parts, +# not chapters. +# +# latex_use_parts = False + +# If true, show page references after internal links. +# +# latex_show_pagerefs = False + +# If true, show URL addresses after external links. +# +# latex_show_urls = False + +# Documents to append as an appendix to all manuals. +# +# latex_appendices = [] + +# It false, will not define \strong, \code,	itleref, \crossref ... but only +# \sphinxstrong, ..., \sphinxtitleref, ... To help avoid clash with user added +# packages. +# +# latex_keep_old_macro_names = True + +# If false, no module index is generated. +# +# latex_domain_indices = True + + +# -- Options for manual page output --------------------------------------- + +# One entry per manual page. List of tuples +# (source start file, name, description, authors, manual section). +man_pages = [ + (master_doc, 'google-auth', 'google-auth Documentation', + [author], 1) +] + +# If true, show URL addresses after external links. +# +# man_show_urls = False + + +# -- Options for Texinfo output ------------------------------------------- + +# Grouping the document tree into Texinfo files. List of tuples +# (source start file, target name, title, author, +# dir menu entry, description, category) +texinfo_documents = [ + (master_doc, 'google-auth', 'google-auth Documentation', + author, 'google-auth', 'One line description of project.', + 'Miscellaneous'), +] + +# Documents to append as an appendix to all manuals. +# +# texinfo_appendices = [] + +# If false, no module index is generated. +# +# texinfo_domain_indices = True + +# How to display URL addresses: 'footnote', 'no', or 'inline'. +# +# texinfo_show_urls = 'footnote' + +# If true, do not generate a @detailmenu in the "Top" node's menu. +# +# texinfo_no_detailmenu = False + + +# Example configuration for intersphinx: refer to the Python standard library. +intersphinx_mapping = {'https://docs.python.org/3.5': None} + +# Autodoc config +autoclass_content = 'both' +autodoc_member_order = 'bysource' 
diff --git a/docs/index.rst b/docs/index.rst new file mode 100644 index 0000000..e7a17e3 --- /dev/null +++ b/docs/index.rst 
@@ -0,0 +1,22 @@ +Welcome to ``google-auth``'s documentation! +=========================================== + +Contents: + +.. toctree:: + :maxdepth: 2 + + reference/modules + +Reference documentation +======================= + +The :doc:`reference documentation <reference/modules>` details the complete API for :mod:`google.auth` and :mod:`google.oauth2`. + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` + 
diff --git a/docs/reference/google.auth.rst b/docs/reference/google.auth.rst new file mode 100644 index 0000000..0533449 --- /dev/null +++ b/docs/reference/google.auth.rst 
@@ -0,0 +1,8 @@ +google.auth package +=================== + +.. automodule:: google.auth + :members: + :undoc-members: + :show-inheritance: + 
diff --git a/docs/reference/google.rst b/docs/reference/google.rst new file mode 100644 index 0000000..58c6da4 --- /dev/null +++ b/docs/reference/google.rst 
@@ -0,0 +1,16 @@ +google package +============== + +.. automodule:: google + :members: + :undoc-members: + :show-inheritance: + +Subpackages +----------- + +.. toctree:: + + google.auth + google.oauth2 + 
diff --git a/docs/reference/modules.rst b/docs/reference/modules.rst new file mode 100644 index 0000000..b1816cc --- /dev/null +++ b/docs/reference/modules.rst 
@@ -0,0 +1,7 @@ +google +====== + +.. toctree:: + :maxdepth: 4 + + google 
diff --git a/google/__init__.py b/google/__init__.py new file mode 100644 index 0000000..a35569c --- /dev/null +++ b/google/__init__.py 
@@ -0,0 +1,22 @@ +# Copyright 2016 Google Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Google namespace package.""" + +try: + import pkg_resources + pkg_resources.declare_namespace(__name__) +except ImportError: + import pkgutil + __path__ = pkgutil.extend_path(__path__, __name__) 
diff --git a/google/auth/__init__.py b/google/auth/__init__.py new file mode 100644 index 0000000..01e3431 --- /dev/null +++ b/google/auth/__init__.py 
@@ -0,0 +1,15 @@ +# Copyright 2016 Google Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Google Auth Library for Python.""" 
diff --git a/google/oauth2/__init__.py b/google/oauth2/__init__.py new file mode 100644 index 0000000..6d3ee7f --- /dev/null +++ b/google/oauth2/__init__.py 
@@ -0,0 +1,15 @@ +# Copyright 2016 Google Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Google OAuth 2.0 Library for Python.""" 
diff --git a/pylintrc b/pylintrc new file mode 100644 index 0000000..1a47c02 --- /dev/null +++ b/pylintrc 
@@ -0,0 +1,164 @@ +[MASTER] +# Add files or directories to the blacklist. They should be base names, not +# paths. +ignore=CVS,.git,.cache,.tox,.nox + +# List of plugins (as comma separated values of python modules names) to load, +# usually to register additional checkers. +# DEFAULT: load-plugins= +# RATIONALE: We want to make sure our docstrings match the objects +# they document. +load-plugins=pylint.extensions.check_docs + +[MESSAGES CONTROL] +# Disable the message, report, category or checker with the given id(s). You +# can either give multiple identifiers separated by comma (,) or put this +# option multiple times (only on the command line, not in the configuration +# file where it should appear only once).You can also use "--disable=all" to +# disable everything first and then reenable specific checks. For example, if +# you want to run only the similarities checker, you can use "--disable=all +# --enable=similarities". If you want to run only the classes checker, but have +# no Warning level messages displayed, use"--disable=all --enable=classes +# --disable=W" +# +# RATIONALE: +# - maybe-no-member: bi-modal functions confuse pylint type inference. +# - no-member: indirections in protobuf-generated code +# - protected-access: helpers use '_foo' of classes from generated code. +# - similarities: 'Bucket' and 'Blob' define 'metageneration' and 'owner' with +# identical implementation but different docstrings. +# - star-args: standard Python idioms for varargs: +# ancestor = Query().filter(*order_props) +# - redefined-variable-type: This error is overzealous and complains at e.g. +# if some_prop: +# return int(value) +# else: +# return float(value) +# - import-error: imports are checked via tests. +# - wrong-import-position: This error is overzealous. It assumes imports are +# completed whenever something non-trivial is +# defined, e.g. +# try: +# from foo import Bar +# except ImportError: +# class Bar(object): +# """Hi everyone""" +# and thus causes subsequent imports to be +# diagnosed as out-of-order. +# - no-name-in-module: Error gives a lot of false positives for names which +# are defined dynamically. Also, any truly missing names +# will be detected by our 100% code coverage. +# - locally-disabled: Allow us to make exceptions in edge cases, notably where +# pylint doesn't recognize inherited properties and methods +# and gives unused-argument errors. +# TEMPORARILY DISABLE AND SHOULD BE REMOVED: +# - fixme: disabled until 1.0 +# +disable = + import-star-module-level, + old-octal-literal, + oct-method, + print-statement, + unpacking-in-except, + parameter-unpacking, + backtick, + old-raise-syntax, + old-ne-operator, + long-suffix, + dict-view-method, + dict-iter-method, + metaclass-assignment, + next-method-called, + raising-string, + indexing-exception, + raw_input-builtin, + long-builtin, + file-builtin, + execfile-builtin, + coerce-builtin, + cmp-builtin, + buffer-builtin, + basestring-builtin, + apply-builtin, + filter-builtin-not-iterating, + using-cmp-argument, + useless-suppression, + range-builtin-not-iterating, + suppressed-message, + no-absolute-import, + old-division, + cmp-method, + reload-builtin, + zip-builtin-not-iterating, + intern-builtin, + unichr-builtin, + reduce-builtin, + standarderror-builtin, + unicode-builtin, + xrange-builtin, + coerce-method, + delslice-method, + getslice-method, + setslice-method, + input-builtin, + round-builtin, + hex-method, + nonzero-method, + map-builtin-not-iterating, + maybe-no-member, + no-member, + protected-access, + similarities, + star-args, + redefined-variable-type, + import-error, + wrong-import-position, + no-name-in-module, + locally-disabled, + fixme + + +[REPORTS] +# Tells whether to display a full report or only the messages +# RATIONALE: noisy +reports=no + +[BASIC] +# Regular expression matching correct method names +# DEFAULT: method-rgx=[a-z_][a-z0-9_]{2,30}$ +# RATIONALE: Some methods have longer names to be more descriptive or precise, +# especially those that implemented wordy RFCs. +method-rgx=[a-z_][a-z0-9_]{2,40}$ + +# Regular expression matching correct function names +# DEFAULT function-rgx=[a-z_][a-z0-9_]{2,30}$ +# RATIONALE: Some methods have longer names to be more descriptive or precise, +# especially those that implemented wordy RFCs. +function-rgx=[a-z_][a-z0-9_]{2,40}$ + +[TYPECHECK] +# List of module names for which member attributes should not be checked +# (useful for modules/projects where namespaces are manipulated during runtime +# and thus existing member attributes cannot be deduced by static analysis. It +# supports qualified module names, as well as Unix pattern matching. +# DEFAULT: ignored-modules= +# RATIONALE: six aliases stuff for compatibility. +# google.protobuf fixes up namespace package "late". +ignored-modules = six, google.protobuf + + +[DESIGN] +# Minimum number of public methods for a class (see R0903). +# DEFAULT: min-public-methods=2 +# RATIONALE: context mgrs may have *no* public methods +min-public-methods=0 + +# Maximum number of arguments for function / method +# DEFAULT: max-args=5 +# RATIONALE: Many credentials classes take a lot of parameters. +max-args = 10 + +# Maximum number of attributes for a class (see R0902). +# DEFAULT: max-attributes=7 +# RATIONALE: Many credentials need to track lots of properties. +max-attributes=15 
diff --git a/pylintrc.tests b/pylintrc.tests new file mode 100644 index 0000000..73b2766 --- /dev/null +++ b/pylintrc.tests 
@@ -0,0 +1,165 @@ +[MASTER] +# Add files or directories to the blacklist. They should be base names, not +# paths. +ignore=CVS,.git,.cache,.tox,.nox + +[MESSAGES CONTROL] +# Disable the message, report, category or checker with the given id(s). You +# can either give multiple identifiers separated by comma (,) or put this +# option multiple times (only on the command line, not in the configuration +# file where it should appear only once).You can also use "--disable=all" to +# disable everything first and then reenable specific checks. For example, if +# you want to run only the similarities checker, you can use "--disable=all +# --enable=similarities". If you want to run only the classes checker, but have +# no Warning level messages displayed, use"--disable=all --enable=classes +# --disable=W" +# +# RATIONALE: +# - maybe-no-member: bi-modal functions confuse pylint type inference. +# - no-member: indirections in protobuf-generated code +# - protected-access: helpers use '_foo' of classes from generated code. +# - similarities: 'Bucket' and 'Blob' define 'metageneration' and 'owner' with +# identical implementation but different docstrings. +# - star-args: standard Python idioms for varargs: +# ancestor = Query().filter(*order_props) +# - redefined-variable-type: This error is overzealous and complains at e.g. +# if some_prop: +# return int(value) +# else: +# return float(value) +# - import-error: imports are checked via tests. +# - wrong-import-position: This error is overzealous. It assumes imports are +# completed whenever something non-trivial is +# defined, e.g. +# try: +# from foo import Bar +# except ImportError: +# class Bar(object): +# """Hi everyone""" +# and thus causes subsequent imports to be +# diagnosed as out-of-order. +# - no-name-in-module: Error gives a lot of false positives for names which +# are defined dynamically. Also, any truly missing names +# will be detected by our 100% code coverage. +# - locally-disabled: Allow us to make exceptions in edge cases, notably where +# pylint doesn't recognize inherited properties and methods +# and gives unused-argument errors. +disable = + import-star-module-level, + old-octal-literal, + oct-method, + print-statement, + unpacking-in-except, + parameter-unpacking, + backtick, + old-raise-syntax, + old-ne-operator, + long-suffix, + dict-view-method, + dict-iter-method, + metaclass-assignment, + next-method-called, + raising-string, + indexing-exception, + raw_input-builtin, + long-builtin, + file-builtin, + execfile-builtin, + coerce-builtin, + cmp-builtin, + buffer-builtin, + basestring-builtin, + apply-builtin, + filter-builtin-not-iterating, + using-cmp-argument, + useless-suppression, + range-builtin-not-iterating, + suppressed-message, + no-absolute-import, + old-division, + cmp-method, + reload-builtin, + zip-builtin-not-iterating, + intern-builtin, + unichr-builtin, + reduce-builtin, + standarderror-builtin, + unicode-builtin, + xrange-builtin, + coerce-method, + delslice-method, + getslice-method, + setslice-method, + input-builtin, + round-builtin, + hex-method, + nonzero-method, + map-builtin-not-iterating, + maybe-no-member, + no-member, + protected-access, + similarities, + star-args, + redefined-variable-type, + import-error, + wrong-import-position, + no-name-in-module, + locally-disabled, + missing-docstring, + redefined-outer-name, + no-self-use, + too-many-locals, + too-many-public-methods, + abstract-method, + method-hidden, + unused-argument + + +[REPORTS] +# Tells whether to display a full report or only the messages +# RATIONALE: noisy +reports=no + +[BASIC] +# Good variable names which should always be accepted, separated by a comma +# DEFAULT: good-names=i,j,k,ex,Run,_ +# RATIONALE: 'fh' is a well-known file handle variable name. +good-names = i, j, k, ex, Run, _, + fh, + +# Regular expression matching correct method names +# DEFAULT: method-rgx=[a-z_][a-z0-9_]{2,30}$ +# RATIONALE: Some methods have longer names to be precise against wordy RFCs. +method-rgx=[a-z_][a-z0-9_]{2,80}$ + +# Regular expression matching correct function names +# DEFAULT function-rgx=[a-z_][a-z0-9_]{2,30}$ +# RATIONALE: Some test methods have long descriptive names. +function-rgx=[a-z_][a-z0-9_]{2,80}$ + +[TYPECHECK] +# List of module names for which member attributes should not be checked +# (useful for modules/projects where namespaces are manipulated during runtime +# and thus existing member attributes cannot be deduced by static analysis. It +# supports qualified module names, as well as Unix pattern matching. +# DEFAULT: ignored-modules= +# RATIONALE: six aliases stuff for compatibility. +# google.protobuf fixes up namespace package "late". +ignored-modules = six, google.protobuf + + +[DESIGN] +# Minimum number of public methods for a class (see R0903). +# DEFAULT: min-public-methods=2 +# RATIONALE: context mgrs may have *no* public methods +min-public-methods=0 + +# Maximum number of arguments for function / method +# DEFAULT: max-args=5 +# RATIONALE: Many credentials classes take a lot of parameters. +max-args = 10 + +# Maximum number of attributes for a class (see R0902). +# DEFAULT: max-attributes=7 +# RATIONALE: Many credentials need to track lots of properties. +max-attributes=15 
diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..2a9acf1 --- /dev/null +++ b/setup.cfg 
@@ -0,0 +1,2 @@ +[bdist_wheel] +universal = 1 
diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..32c5d02 --- /dev/null +++ b/setup.py 
@@ -0,0 +1,58 @@ +# Copyright 2014 Google Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from setuptools import find_packages +from setuptools import setup + + +DEPENDENCIES = ( + 'pyasn1>=0.1.7', + 'pyasn1-modules>=0.0.5', + 'rsa>=3.1.4', + 'six>=1.9.0', +) + + +with open('README.rst', 'r') as fh: + long_description = fh.read() + + +setup( + name='google-auth', + version='0.0.1', + author='Google Cloud Platform', + author_email='jonwayne+google-auth@google.com', + description='Google Authentication Library', + long_description=long_description, + packages=find_packages(exclude='tests'), + namespace_packages=('google',), + install_requires=DEPENDENCIES, + license='Apache 2.0', + keywords='google auth oauth client', + classifiers=( + 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.4', + 'Programming Language :: Python :: 3.5', + 'Development Status :: 3 - Alpha', + 'Intended Audience :: Developers', + 'License :: OSI Approved :: Apache Software License', + 'Operating System :: POSIX', + 'Operating System :: Microsoft :: Windows', + 'Operating System :: MacOS :: MacOS X', + 'Operating System :: OS Independent', + 'Topic :: Internet :: WWW/HTTP', + ), +) 
diff --git a/tests/__init__.py b/tests/__init__.py new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/tests/__init__.py 
diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..d2a5f1f --- /dev/null +++ b/tox.ini 
@@ -0,0 +1,49 @@ +[tox] +envlist = lint,py27,py34,py35,pypy,cover + +[testenv] +deps = + flask + mock + pytest + pytest-cov + pytest-localserver + urllib3 +commands = + py.test --cov=google.auth --cov=google.oauth2 --cov=tests {posargs:tests} + +[testenv:cover] +basepython = python3.5 +commands = + py.test --cov=google.auth --cov=google.oauth2 --cov=tests --cov-report= tests + coverage report --show-missing --fail-under=100 +deps = + {[testenv]deps} + +[testenv:docgen] +basepython = python3.5 +deps = + {[testenv]deps} + sphinx +commands = sphinx-apidoc --output-dir docs/reference --separate --module-first google + +[testenv:docs] +basepython = python3.5 +deps = + {[testenv]deps} + sphinx +commands = make -C docs html + +[testenv:lint] +basepython = python3.5 +commands = + flake8 \ + --import-order-style=google \ + --application-import-names="google,tests" \ + google tests + pylint --rcfile pylintrc google + pylint --rcfile pylintrc.tests tests +deps = + flake8 + flake8-import-order + pylint